<#include "default/common/head.html" />
<link rel="stylesheet" href="${reroot}/static/assets/css/comment.css"  >
<br>
<div class="of-content" style="clear: both;margin-top: 60px">
    <div class="of-crad" style="width: 900px;margin: 0 auto;">
        <@of.content site_id=site.site_id content_id=params.content_id>
            <h2 class="content-title"> ${content.title_name}</h2>
            <div class="content-inf">发布时间：${content.create_time}&nbsp;&nbsp; 作者：${content.author}&nbsp;&nbsp;浏览次数：<span
                    id="views">${content.clicks}</span>
            </div>
            <div class="content-txt">${content.content}</div>
        </@of.content>
    </div>
    <#if fieldDetail??>
        <!--显示自定义的表单--->
        <div class="of-crad" style="width: 900px;margin: 0 auto;">
            <#include "default/common/form.html" />
        </div>
        <!-- 评论-->
        <script src="${reroot}/static/lib/jquery-1.10.1.min.js"></script>
        <script src="${reroot}/static/assets/js/utile.js"></script>
        <script>
        layui.use(['form','carousel','element'], function () {
            var form = layui.form;
            //监听提交
            form.on('submit(save)', function(data) {
                utile.ajaxSubmit({"url":"${webroot}/api/v1/content/save.json",data:data.field}, function(data) {
                    if (data.code == '200') {
                        alert("数据提交成功");
                        location.reload(this);
                    } else {
                        alert(data.msg);
                    }
                })
                return false;
            });
        });
        </script>
    <#else>
        <!-- 评论-->
            <div class="of-crad" style="width: 900px;margin: 0 auto;">

            <section class="comments">
                <h1><span>用户评论${params.content_id}</span></h1>
                <form  class="layui-form">
                    <textarea name="comment_content" maxlength="8000"  required lay-verify="required"  placeholder="发表你此时的观点 ……" class="comments-text" id="comments-text"></textarea>
                    <div class="plfr1 clearfix">
                        <div class="down clearfix">
                            <input type="hidden" name="content_id" value="${params.content_id}">
                            <input type="hidden" name="site_id" value="${site.site_id}">
                            <input type="hidden" name="check_status" value="1">
                            <input type="submit" lay-submit  value="提交评论" lay-filter="save" class="submit-on">
                        </div>
                    </div>
                </form>
            </section>
            <section class="comments-list" style="margin-top:60px;">
                <@of.comment site_id=site.site_id  content_id=params.content_id limit="10">
                <ul>
                    <#if comment ??>
                    <#list comment as data >
                    <li>
                        <span>评论时间：${data.comment_time} </span><br>
                        ${data.comment_content}</li>
                </#list>
                <#else>
                <div class="zanwu">暂无相关评论！</div>
            </#if>
            </ul>
            </@of.comment>
            </section>
            </div>
            </div>
            <script src="${reroot}/static/lib/jquery-1.10.1.min.js"></script>
            <script src="${reroot}/static/assets/js/utile.js"></script>
            <script>
                layui.use(['form','carousel','element'], function () {
                    var carousel = layui.carousel;
                    var element = layui.element;
                    var form = layui.form;
                    //监听提交
                    form.on('submit(comment)', function(data) {
                        utile.ajaxSubmit({"url":"${webroot}/api/v1/comment/save.json",data:data.field}, function(data) {
                                if (data.code == '200') {
                                location.reload(this);
                            } else {
                                alert(data.msg);
                            }
                        })
                        return false;
                    });
                });
            </script>
</#if>


</body>
</html>